package cz.muni.fi.pb138.odsKartW;

import java.util.List;
import org.jopendocument.dom.spreadsheet.Sheet;

/**
 * Interface for work with media.
 * 
 * @author Michal Sorentíny
 * @version 05/05/2011
 */
public interface MediaManager {
    
    /**
     * Finds all media on given sheet
     * @param sheetLabel refers to name of sheet
     * @return all media in the given sheet
     * @throws ODSKartWException on any error
     */
    public List<Medium> findAllMedia(String sheetLabel)throws ODSKartWException;
    
    /**
     * Returns names of headers from table
     * @param sheet of which header names we want to know
     * @throws ODSKartWException on any error
     * @return List of header names, first item in list is Id
     */
    public List<String> getHeader(String sheetLabel) throws ODSKartWException;
    
    /**
     * Returns sheet labels of all sheets
     * @throws ODSKartWException on any error
     * @return List of header names, first item in list is Id
     */
    public List<String> getSheetLabels() throws ODSKartWException;
    
    /**
     * Inserts medium into the database under last Medium on given sheet
     * There must be set sheetLabel!!!
     * Medium do not have to set its ID, because ID is row number
     * 
     * @param medium medium to insert
     * @throws ODSKartWException on any error
     */
    public void createMedium(Medium medium) throws ODSKartWException;
   
    /**
     * Deletes medium from the database according its ID and sheetLabel
     * Method copy Medium from last row in given sheet on its place and erase last row
     * 
     * @param ID is id of medium
     * @param sheetLabel is name of sheet where is given medium
     * @throws ODSKartWException on any error
     */
    public void deleteMediumAccordingIdAndSheetLabel(int ID,String sheetLabel) throws ODSKartWException;
    
    /**
     * Get medium from the database according its ID and sheetLabel
     * @param ID is id of medium
     * @param sheetLabel is name of sheet where is given medium
     * @return medium
     * @throws ODSKartWException on any error
     */
    public Medium getMediumAccordingIdAndSheetLabel(int ID,String sheetLabel) throws ODSKartWException;
    
    /**
     * Updates medium in the database.
     * There must be set its corect ID and SheetLabel!!!
     * 
     * @param medium to update
     * @throws ODSKartWException on any error
     */
    public void updateMedium(Medium medium) throws ODSKartWException;
    
  
    /**
     * Resolve if there is present medium with same titles on sheet
     * @param medium to compare (attribute sheetLabel must be set)
     * @return true if medium with same titles was found on sheet
     */
    public boolean sameMediumPresent(Medium medium) throws ODSKartWException;
    
    /**
     * Finds media containing a Title with given name in certain column on given sheet
     * @param sheetLabel sheetLabel sheet
     * @param title name of he wanted Title
     * @param columnNumber number of column(0 is column where Id is written)
     * @return List of media containing given title in given column and sheet
     */
    public List<Medium> getMediums(String sheetLabel, String title, int columnNumber) throws ODSKartWException;
    
    /**
     * Finds media containing a Title with given name on certain sheet
     * @param sheetLabel sheetLabel sheet
     * @param title name of he wanted Title
     * @return List of media containing given title on given sheet
     */
    public List<Medium> getMediums(String sheetLabel, String title) throws ODSKartWException;
    
     /**
     * Finds media containing a Title with given name on whole spread sheet
     * @param title name of the wanted Title
     * @throws ODSKartWException on any error
     * @return List of media containing given title
     */
    public List<Medium> getMediums(String title) throws ODSKartWException;
    
   
    
    //TREBA???
    //public void deleteMedium(Medium medium) throws ODSKartWException;
    //public Medium getMediumByLabelAndSheet(String label, String sheetLabel) throws ODSKartWException;
}
